import { createRouter, createWebHashHistory } from 'vue-router'
//导入自定义的页面
import IndexVue from '../views/Index.vue'
import Page1 from '../views/Page1.vue'
import Page2 from '../views/Page2.vue'

//路由规则配置
const routes = [
  {
    path: '/',            //路径  /代表首页
    name: 'index',        //名称
    component: IndexVue,   //组件
    children:[            //嵌套路由
      {
        path: '/page1',
        name: 'page1',
        component: Page1
      },
      {
        path: '/page2',
        name: 'page2',
        component: Page2
      }
    ]
  }
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
